package org.zsl.controller.springmvc;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zsl.model.ResponseMessage;
import org.zsl.model.User;
import org.zsl.service.UserService2;

import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService2 userService2;

    @RequestMapping("/login")
    @ResponseBody
    public ResponseMessage login(User user){

        System.out.println(user.getSuccess());
         return  userService2.login(user);
    }

    @RequestMapping("/list")
    @ResponseBody
    public List<User> list(){


        System.out.println("the controller is running!");
        return  userService2.getList();
    }
}
